﻿using SAIM.Models.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SAIM.Models
{
    public class NotificationGridData
    {
        public int current { get; set; }
        public int rowCount { get; set; }
        public int total { get; set; }
        public List<Notification> rows;

        public NotificationGridData(List<UsersNotificationsDAL> notifications)
        {
            rows = new List<Notification>();
            foreach(UsersNotificationsDAL notification in notifications)
            {
                rows.Add(new Notification() 
                { 
                    Date = notification.Notifications.NotificationDate.ToString(),
                    Detail = notification.Notifications.Details,
                    Url = "/Notifications/RedirectUrl/" + notification.NotificationId,
                    RemoveUrl = "/Notifications/Remove/" + notification.NotificationId,
                    status = (notification.Active != null && notification.Active == true) ? 1 : -1 
                });
            }
        }
    }

    public class Notification
    {
        public string Date { get; set; }
        public string Detail { get; set; }
        public string Url { get; set; }
        public string RemoveUrl { get; set; }
        public int status { get; set; }
    }
}